preg replace h2 tags with spaces [closed]

Posted by fire on Stack Overflow See other posts from Stack Overflow or by fire
Published on 2010-05-28T14:05:31Z Indexed on 2010/05/28 14:31 UTC
Read the original article Hit count: 244

Filed under:
|

Possible Duplicate:
PHP Regular express to remove <h1> tags (and their content)

I have some HTML that looks like this:

<h2>
Fund Management</h2>
<p>
The majority of property investments are now made via our Funds.</p>

Trying to use a regular expression to strip h2 tags but doesn't work because of the space between the opening and closing h2 tags.

preg_replace('/<h2>(.+?)<\/h2>/', '', $content);

Any ideas on how to make this work?

Also I would ideally like it to replace h1-h6 tags so maybe it needs [1-6] or something?

© Stack Overflow or respective owner

Related posts about php

Related posts about preg-replace